package huoye.shops.huoye.operation.presenter;

import com.codeideology.android.lang.entity.Paging;

import java.util.Iterator;
import java.util.List;

import huoye.shops.base.BasePresenter;
import huoye.shops.base.MineBaseJsonRequestCallback;
import huoye.shops.huoye.operation.model.CurUserLotteryData;
import huoye.shops.huoye.operation.model.CurUserLotteryInfos;
import huoye.shops.huoye.operation.model.ShopPrizeList;
import huoye.shops.huoye.operation.networt.OperationService;
import huoye.shops.huoye.operation.view.ICurUserLotteryInfosView;
import huoye.shops.huoye.operation.view.IManagePrizeRefreshView;

import static huoye.shops.huoye.operation.activity.ManagePrizeActivity.EXTRAS_KEY_PRIZE_SELECT;


/**
 * Created by uesr on 2017/7/19.
 */

public class CurUserLotteryInfosPresenter extends BasePresenter<ICurUserLotteryInfosView> {

    OperationService mService;

    //获取店铺活动中奖用户列表
    public void getCurUserLotteryInfos(String eventId){
        mService.getCurUserLotteryInfos(eventId, new MineBaseJsonRequestCallback<CurUserLotteryData>(CurUserLotteryData.class) {

            @Override
            public void onSuccess(CurUserLotteryData curUserLotteryData) {
                super.onSuccess(curUserLotteryData);
                view.setAdapter(curUserLotteryData.getInfos());
            }

            //网络请求失败
            @Override
            public void onFailure(String msg, String code, Throwable e) {
                super.onFailure(msg, code, e);
                view.makeToast(msg);
            }

            //加载结束
            @Override
            public void onNetworkFail() {
                super.onNetworkFail();
                view.onNetworkFail();
            }

            //加载中
            @Override
            public void onFinish() {
                super.onFinish();
                view.hideProcessingIndicator();
            }
        });
    }



    @Override
    public void onStart() {
        mService = new OperationService();
    }
}
